<template>
  <div>
    <div style="text-align: center;"><h4>订单页面</h4></div>
    <el-table
    :data="orders.orderdict"
    stripe
    style="width: 100%">
    <el-table-column
      prop="cname"
      label="课程名"
      width="180">
    </el-table-column>
    <el-table-column
      prop="price"
      label="价格"
      width="180">
    </el-table-column>
    <el-table-column
      prop="number"
      label="数量">
    </el-table-column>
  </el-table>
  <div style=" text-align: right;">
    <el-descriptions class="margin-top"  :column="3" >
  <el-descriptions-item>
      <template slot="label">
        总价
      </template>
      {{orders.tmoney}}
    </el-descriptions-item>
    </el-descriptions>
  </div>
  
  <div style="margin-top: 20px; text-align: right;">
    <el-button @click="orderpay">去支付</el-button>
  </div>
  </div>
</template>

<script>
export default {
    data(){
        return{
            order_no:this.$route.query.order_no,
            orders:[]
        }
    },
    mounted(){
        this.getOrders()
    },
    methods:{
        getOrders(){
          this.axios.get("course/orders?order_no="+this.order_no).then(res=>{
              this.orders = res.data.orders
              
          })
        },
        orderpay(){
          this.axios.post("course/buytcourse?order_no="+this.order_no).then(res=>{
            if(res.data.code == 200){
                    window.location.href = res.data.url
            }
          })
        }
    }
}
</script>

<style>

</style>